fix: trim whitespace from API keys and host config - #181
Conversation
posthog-dotnet Compliance ReportDate: 2026-04-21 11:59:27 UTC
|
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ❌ | 44ms |
Failures
request_payload.request_with_person_properties_device_id
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
|
dustinbyrne
left a comment
There was a problem hiding this comment.
approving to unblock, but the null check is needed
💡 Motivation and Context
This ports the whitespace-trimming fix from
posthog-gotoposthog-dotnet. It trims surrounding spaces and line breaks from the project API key and personal API key before using them so the SDK does not silently send invalid tokens or treat whitespace-only personal API keys as valid local-evaluation credentials.💚 How did you test it?
dotnet test tests/UnitTests/UnitTests.csproj -f net8.0 --filter "FullyQualifiedName~LogsWarningWhenPersonalApiKeyIsBlankAfterTrimmingWhitespace|FullyQualifiedName~LogsErrorWhenProjectApiKeyIsBlankAfterTrimmingWhitespace|FullyQualifiedName~LogsWarningWhenPersonalApiKeyIsNull"📝 Checklist
If releasing new changes
releaselabel to the PRbump-patch,bump-minor, orbump-major